home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / MyProfiler.p < prev    next >
Encoding:
Text File  |  1996-05-29  |  766 b   |  48 lines  |  [TEXT/CWIE]

  1. unit MyProfiler;
  2.  
  3. interface
  4.  
  5.     procedure StartupProfiler;
  6.     
  7. implementation
  8.  
  9.     uses
  10.         Profiler, MyStartup;
  11.     
  12.     var
  13.         good:Boolean;
  14.         
  15.     function StartProfiler(var msg: integer): OSStatus;
  16.         var
  17.             err:OSErr;
  18.     begin
  19. {$unused(msg)}
  20.         err := ProfilerInit(ord(collectDetailed), ord(bestTimeBase), 100, 5);
  21.         good := err = noErr;
  22.         if good then begin
  23.             ProfilerSetStatus(0);
  24.         end;
  25.         StartProfiler := noErr;
  26.     end;
  27.     
  28.     procedure FinishProfiler;
  29.         var
  30.             functionSize :longint;
  31.             stackSize: longint;
  32.             err:OSErr;
  33.     begin
  34.         if good then begin
  35.             ProfilerTerm;
  36.             ProfilerGetDataSizes(functionSize, stackSize);
  37.             err := ProfilerDump('ProfileData');
  38.             Debugger;
  39.         end;
  40.     end;
  41.     
  42.     procedure StartupProfiler;
  43.     begin
  44.         SetStartup(StartProfiler, nil, 0, FinishProfiler);
  45.     end;
  46.     
  47. end.
  48.